﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using Linkmeme.Controllers;
using System.Web.Security;
using Linkmeme.Models;

namespace Linkmeme.Views.Shared
{
    public partial class Main : ViewMasterPage
    {

        protected List<Linkmeme.Models.User> GetFriendList()
        {
            List<Linkmeme.Models.User> flist = new List<Linkmeme.Models.User>();

            if (HttpContext.Current.User.Identity.IsAuthenticated)
            {
                Guid uid = (Guid)Membership.Provider.GetUser(HttpContext.Current.User.Identity.Name, true).ProviderUserKey;
                LinkmemeDataContext context = new LinkmemeDataContext();
                Linkmeme.Models.User user = context.Users.Single(u => u.UserId == uid);
                flist = user.Friends.ToList();
            }
            return flist;
        }
    }
}
